package top.datacluster.basic.sort;

public class InsertSort {

    public static void sort(Comparable[] data){

        for (int i = 1; i < data.length; i++){
            for (int j = i; j > 0; j--){
                if (data[j].compareTo(data[j - 1]) < 0){
                    Comparable temp = data[j - 1];
                    data[j - 1] = data[j];
                    data[j] = temp;
                }
            }
        }
    }
}
